package com.example.myapplication;

import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.Toast;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

public class FocusActivity extends AppCompatActivity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.focus_layout);
        LinearLayout linearLayout1 = findViewById(R.id.ly1);
        LinearLayout linearLayout2 = findViewById(R.id.ly2);
        linearLayout1.setOnFocusChangeListener(new View.OnFocusChangeListener() {
            @Override
            public void onFocusChange(View v, boolean hasFocus) {
                Toast.makeText(FocusActivity.this,"你选择了1号",Toast.LENGTH_SHORT).show();
            }
        });
        linearLayout2.setOnFocusChangeListener(new View.OnFocusChangeListener() {
            @Override
            public void onFocusChange(View v, boolean hasFocus) {
                Toast.makeText(FocusActivity.this,"你选择了2号",Toast.LENGTH_SHORT).show();
            }
        });
    }
}
